package com.resume.aipeople;

import ai.z.openapi.ZhipuAiClient;
import com.baidu.aip.speech.AipSpeech;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

@SpringBootApplication
public class AipeopleApplication {

    @Value("${zai.api.key}")
    private String zaiApiKey;

    @Value("${baidu.voice.app.id}")
    private String baiduAppId;

    @Value("${baidu.voice.api.key}")
    private String baiduApiKey;

    @Value("${baidu.voice.secret.key}")
    private String baiduSecretKey;

    public static void main(String[] args) {
        SpringApplication.run(AipeopleApplication.class, args);
    }

    @Bean
    public ZhipuAiClient zhipuAiClient() {
        return ZhipuAiClient.builder()
                .apiKey(zaiApiKey)
                .build();
    }

    @Bean
    public AipSpeech aipSpeech() {
        // 初始化百度语音SDK
        AipSpeech client = new AipSpeech(baiduAppId, baiduApiKey, baiduSecretKey);
        
        // 设置网络连接参数
        client.setConnectionTimeoutInMillis(20000);
        client.setSocketTimeoutInMillis(60000);
        
        return client;
    }
}
